/// @description Insert description here
// You can write your code in this editor
//surface_resize(application_surface, RESOLUTION_W, RESOLUTION_H);
//display_set_gui_maximize();


var _u_pos = u_pos;
var _u_pos2 = u_pos2;
var _u_zz = u_zz;
var _u_str = u_str;
var _u_dir = u_dir;
var _u_fov = u_fov;
var _vb = vb;
var _vx = vx;
var _vy = vy;

if(!surface_exists(shSurface))
{
	shSurface = surface_create(RESOLUTION_W, RESOLUTION_H);
}
matrix_set(matrix_world, matrix_build(-vx, -vy, 0, 0, 0, 0, 1, 1, 1));
surface_set_target(shSurface);
draw_clear_alpha(c_dkgray, 0);
with(oLight)
{
	gpu_set_blendmode_ext_sepalpha(bm_zero, bm_one, bm_one, bm_one);
	//绘制阴影
	shader_set(shShadow);
	shader_set_uniform_f(_u_pos2, x, y);
	vertex_submit(_vb, pr_trianglelist, -1);	
	
	gpu_set_blendmode_ext_sepalpha(bm_inv_dest_alpha, bm_one, bm_zero, bm_zero);
	shader_set(shLight);
	shader_set_uniform_f(_u_pos, x, y);
	shader_set_uniform_f(_u_zz,size);
	shader_set_uniform_f(_u_str,str);
	shader_set_uniform_f(_u_dir,dir);
	shader_set_uniform_f(_u_fov,fov);
	draw_rectangle_color(_vx, _vy,_vx + 320, _vy + 180,colour, colour, colour, colour, 0);	
	

}
shader_reset();
gpu_set_blendmode_ext(bm_zero, bm_src_alpha);
draw_surface(application_surface, vx, vy);
surface_reset_target();
matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0, 1, 1, 1));

gpu_set_blendmode_ext(bm_dest_color,bm_inv_dest_alpha);
//draw_surface(shSurface, 0, 0);
draw_surface(shSurface, vx, vy);
gpu_set_blendmode(bm_normal);

